export class Const {
  static commonUrl = '/banksearchSystem';
  // static commonUrl = '';
  static format = "YYYY-MM-DD";
  static dealMap = (arr) => {
    let obj = {};
    for (let item of arr) {
      obj[item.value] = {
        text: item.label
      }
    };
    return obj;
  };
  // 证件类型
  static idTypeListForSearch = [
    { label: '身份证', value: 'NI' },
    { label: '护照', value: 'PP,PSPT' },
    // { label: '护照', value: 'PSPT' },
    { label: '军官证', value: 'ID' },
    { label: '其他', value: 'UU' }
  ];
  static idTypeList = [
    { label: '身份证', value: 'NI' },
    { label: '护照', value: 'PP' },
    { label: '护照', value: 'PSPT' },
    { label: '军官证', value: 'ID' },
    { label: '其他', value: 'UU' }
  ];
  static idTypeMap = {
    'NI': { text: '身份证' },
    'PP': { text: '护照' },
    'PSPT': { text: '护照' },
    'ID': { text: '军官证' },
    'UU': { text: '其他' },
    'CC': { text: '信用卡' },
    'PP,PSPT': { text: '护照' },
  };
  // 航班号处理
  static formatFlightNo = val => {
    if (!val) {
      return '';
    } else if (val.length < 3 || /^\D/.test(val)) {
      return ''.toUpperCase.call(val);
    } else if (/^\d{2}/.test(val)) {
      return `3U${val}`;
    } else {
      return val;
    }
  };
  // 事故单状态 0未结案 1已结案 2草稿 3已作废
  static accidentStatusList = [
    { label: '处理中', value: 0 },
    { label: '已结案', value: 1 },
    { label: '待处理', value: 2 },
    { label: '已作废', value: 3 },
    // { label: 'H5草稿箱', value: 5 },
  ];
  static accidentStatusMap = Const.dealMap(Const.accidentStatusList);
  static accidentReasonList = [
    { label: '错运', value: 1 },
    { label: '丢失', value: 2 },
    { label: '内物缺失', value: 3 },
    { label: '其他原因', value: 4 },
    { label: '错挂', value: 5 },
    { label: '脱牌', value: 6 },
    { label: '漏装', value: 7 },
    { label: '卡带', value: 8 },
    { label: '减载', value: 9 },
    { label: '安扣', value: 10 },
    { label: '错提', value: 11 },
    { label: '错卸', value: 12 },
    { label: '行李破损', value: 13 },
  ];
  static accidentReasonMap = Const.dealMap(Const.accidentReasonList);
  static permissionsType = new Map()
    .set(1, 'damagedLuggage')
    .set(2, 'lessLuggage')
    .set(3, 'moreLuggage')
    .set(6, 'internalMissingLuggage')
    .set(7, 'outDamagedLuggage');
}
